<template>
	<view>
		<view id="head">
			<view class="back" @click="$back">返回</view>
			<text>会议记录</text>
		</view>
		<view id="main">
			<view id="search">
				<view class="item">
					<view class="label">评吸时间：</view>
					<uni-datetime-picker class="input" type="daterange" v-model="meetingTime" placeholder="" />
				</view>
				<view class="item">
					<view class="label">评吸任务名称：</view>
					<input class="input_" type="text" v-model="meetingName" />
				</view>
				<view class="btn_list">
					<view class="btn" @click="reset()" style="margin-right: 10px;">重置</view>
					<view class="btn" @click="getData()">搜索</view>
				</view>
			</view>
		</view>
		<view class="smian">
			<view class="table">
				<view class="head">
					<view>评吸会议任务名称</view>
					<view>评吸会议时间</view>
					<view>操作</view>
				</view>
				<view class="tabItem" v-for="item in tableData" :key="item.id">

					<view class="item">{{item.meetingName}}</view>
					<view class="item">{{item.meetingTime}}</view>
					<view class="item" @click="view_tab(item)">查看</view>


				</view>
			</view>
		</view>
		<view style="height: 20rpx;"></view>
		<page-pagination size="large" color="rgba(39, 177, 134, 1)" :total="page.total" :pageSize="page.pageSize"
			:pageNo="page.pageNo" @change="change"></page-pagination>


		<zero-loading v-if="isLoading" :mask="true"></zero-loading>
	</view>


</template>

<script>
	import {
		getMeetingPage
	} from "@/api/meeting.js"
	export default {
		components: {

		},
		data() {
			return {
				tableData: [],
				meetingTime: [],
				meetingName: '',
				page: {
					total: 100,
					pageSize: 10,
					pageNo: 1
				}
			}
		},
		methods: {
			getData() {

				let requestData = {
					pageSize: this.page.pageSize,
					pageNo: this.page.pageNo,
					meetingName: this.meetingName
				}
				if (this.meetingTime.length == 2) {
					requestData.meetingTimeStar = this.meetingTime[0]
					requestData.meetingTimeEnd = this.meetingTime[1]
				}

				getMeetingPage(requestData).then(res => {
					if (res.code == 200) {
						this.tableData = res.data;
						this.page.total = res.data[0]?.total || 0
						// this.pageNo = res.data.pageNo
					}

				}) 
 
			}, 
			
			// 重置搜索条件
			reset() {
				this.page.pageSize = 10,
				this.page.pageNo = 1,
				this.meetingName = ""
				this.meetingTime = []
				this.getData()
			},

			async change(pageNo, type) { // 当前页改变
				this.page.pageNo = pageNo;
				console.log("点击了" + type + "，当前页：" + pageNo);
				
				await this.getData()
			},
			sizeChange(pageSize) { // 每页条数改变
				this.page.pageSize = pageSize;
				console.log("每页", pageSize, "条");
			},
			changeTotal() { // 更改总条数
				this.page.total = 555
			},
			changepageNo() { // 更改当前页
				this.page.pageNo = 3
			},
			// 查看
			view_tab(item) {
				console.log(item);
				uni.navigateTo({
					url: `/pages/history/history?id=${item.id}`,
				})
			} 
		},
		created() {
			this.getData()
		}
	}
</script>

<style lang="scss" scoped>
	#main {
		width: 678rpx;
		margin: 0 auto;
	}

	#search {
		height: 29.65rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 26.35rpx;

		.item {
			font-size: 11rpx;
			font-weight: 400;
			color: #333333;
			display: flex;
			align-items: center;

			.label {
				margin-right: 8.24rpx;
			}

			.input {
				// width: 183rpx;
				// height: 30rpx;
				// background: #F8F8F8;
				// border-radius: 15rpx;
				// border: 0;
				// line-height: 30rpx;
			}

			.input_ {
				width: 183rpx;
				height: 30rpx;
				background: #F8F8F8;
				border-radius: 15rpx;
				border: 0;
				line-height: 30rpx;
				padding: 0 10rpx;
			}
		}


		.btn_list {
			display: flex;
			align-items: center;
		}
		.btn {
			width: 56rpx;
			height: 27rpx;
			background: linear-gradient(132deg, #68DC8F 0%, #27B186 100%);
			border-radius: 13rpx;
			font-size: 11rpx;
			color: #FFFFFF;
			font-weight: bold;
			line-height: 27rpx;
			text-align: center;
		}
	}

	.table {
		width: 678rpx;
		margin: 0 auto;
		margin-top: 15.92rpx;

		.head {
			height: 29rpx;
			background: #F3FFF9;
			border-radius: 3rpx;
			opacity: 1;
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: #6C9789;
			font-weight: bold;
			font-size: 11rpx;
			padding: 0 20rpx;

			view {
				flex: 1;
			}

			>view:nth-child(3) {
				flex: none;
				width: 30rpx;
			}

		}



		.tabItem {
			height: 30rpx;
			background: #F8F8F8;
			border-radius: 3rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			align-items: center;
			padding: 0 24rpx;
			margin-top: 10rpx;

			.item {
				font-weight: 400;
				color: #333333;
				color: #333333;
				flex: 1;

				&:nth-child(3) {
					cursor: pointer;
					flex: none;
					width: 30rpx;
				}
			}

			.list {
				display: flex;
				justify-content: space-between;
				align-items: center;
				flex: 1;
				margin: 0 140rpx;

				.i {
					width: 57rpx;
					height: 27rpx;
					background: #FFFFFF;
					border-radius: 4rpx;
					opacity: 1;
					font-weight: 400;
					color: #999999;
					font-size: 11rpx;
					line-height: 27rpx;
					text-align: center;
					overflow: hidden;
				}

				.on {
					border: 1rpx solid #27B186;
				}
			}

			.btn {
				width: 57rpx;
				height: 27rpx;
				background: #FFFFFF;
				border-radius: 4rpx;
				line-height: 27rpx;
				text-align: center;
				font-size: 11rpx;
				color: #999999;
			}

			.btnOn {
				background: linear-gradient(132deg, #68DC8F 0%, #27B186 100%);
				color: #FFFFFF;
			}
		}

	}
</style>